package fr.uniscol.siecle.model;

import java.io.Serializable;

public class Commune implements Serializable, DonneeSiecle {

	private Departement departement = null;
	
	private String code = null;
	
	private String libelle = null;

	public Commune() {
	}

	public Commune(String code, String libelle) {
		super();
		this.code = code;
		this.libelle = libelle;
	}

	public Departement getDepartement() {
		return departement;
	}

	public void setDepartement(Departement departement) {
		this.departement = departement;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getLibelle() {
		if(libelle == null){
			libelle = "";
		}
		return libelle;
	}

	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}

	@Override
	public boolean equals(Object obj) {
		Commune c = (Commune)obj;
		return getCode().equals(c.getCode());
	}
}
